// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();
const {
  MAILER_SERVICE,
  MAILER_PORT,
  MAILER_AUTH_USER,
  MAILER_AUTH_PASS,
  AUDIO_2_TXT_BAIDU_AK,
  AUDIO_2_TXT_BAIDU_SK,
  TXT_2_AUDIO_Volcengine_APPID,
  TXT_2_AUDIO_Volcengine_TOKEN,
  TXT_2_AUDIO_Volcengine_SK,
  TXT_2_AUDIO_Volcengine_CLUSTER,
} = process.env;
export default () => ({
  port: process.env.HTTP_PORT || 3000,
  websocketPort: Number(process.env.WEBSOCKET_PORT),
  database: {
    host: process.env.DATABASE_HOST,
    port: parseInt(process.env.DATABASE_PORT, 10) || 3306,
    username: process.env.DATABASE_USER,
    password: process.env.DATABASE_PASSWORD,
    name: process.env.DATABASE_NAME,
  },
  // redis: {
  //   host: process.env.REDIS_HOST,
  //   port: parseInt(process.env.REDIS_PORT, 10) || 6379,
  //   password: process.env.REDIS_PASSWORD,
  //   db: parseInt(process.env.REDIS_DB, 10),
  //   ttl:
  //     process.env.REDIS_TTL.split('*')
  //       .map((str) => Number(str))
  //       .reduce((prev: number, curr: number) => {
  //         return prev * curr;
  //       }) || 6,
  // },
  // bull: {
  //   redis: {
  //     db: parseInt(process.env.BULL_REDIS_DB, 10),
  //   },
  // },
  jwt: {
    secret: 'wet6u6kkmu4564323#k;a+tm46m.02l,a!gq',
    expiresIn: '7d', // 60 * 60 * 24 * 0.5,
  },
  upload: {
    dirPath: process.env.UPLOAD_DIR_PATH,
    dirPrefix: process.env.UPLOAD_DIR_PREFIX,
  },
  gpt: {
    apiKey: process.env.OPENAI_API_KEY,
  },
  sms: {
    key: process.env.SMS_KEY,
    secret: process.env.SMS_SECRET,
  },
  apiPrefix: process.env.API_PREFIX,
  swagger: {
    title: process.env.API_DOCUMENT_TITLE,
  },
  mail: {
    service: MAILER_SERVICE,
    port: MAILER_PORT,
    auth: {
      user: MAILER_AUTH_USER,
      pass: MAILER_AUTH_PASS,
    },
  },
  baiduAudio2txt: {
    ak: AUDIO_2_TXT_BAIDU_AK,
    sk: AUDIO_2_TXT_BAIDU_SK,
  },
  tts: {
    key: process.env.TTS_KEY,
    region: process.env.TTS_REGION,
    // dirPath: process.env.TTS_DIR_PATH,
    // dirPrefix: process.env.TTS_DIR_PREFIX,
  },
  translator: {
    key: process.env.TRANSLATOR_KEY,
    region: process.env.TRANSLATOR_REGION,
  },
  volcengine: {
    appid: TXT_2_AUDIO_Volcengine_APPID,
    token: TXT_2_AUDIO_Volcengine_TOKEN,
    cluster: TXT_2_AUDIO_Volcengine_CLUSTER,
    sk: TXT_2_AUDIO_Volcengine_SK,
  },
});
